<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* 0, 0, 2, 1 */
    .c1 .c2 div {
      color: blue;
    }

    /* 0, 1, 0, 1 */
    #box1 div {
      color: yellow;
    }

    /* 0, 1, 0, 1 */
    div #box3 {
      color: green;
    }
    /* 当优先级一样时, 比较层叠性, 谁写在最后谁说了算 */
  </style>
</head>

<body>
  <div id="box1" class="c1">
    <div id="box2" class="c2">
      <div id="box3" class="c3">
        这行文本是什么颜色?
      </div>
    </div>
  </div>
</body>

</html>